package 复制书稿;

import java.util.Scanner;


public class Main {
    static int N = 510, n, k;
    static int[] w = new int[N];
    static int[] left = new int[N];
    static int[] right = new int[N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        k = in.nextInt();
        int l = 0, r = (int) 1e9;
        for (int i = 1; i <= n; i++) {
            w[i] = in.nextInt();
            l = Math.max(l, w[i]);
        }
        while (l < r) {
            int mid = l + r >> 1;
            if (check(mid)) {
                r = mid;
            } else {
                l = mid + 1;
            }
        }
        check(l);
        for (int i = k; i >= 1; i--) {
            System.out.println(left[i] + " " + right[i]);
        }
    }

    private static boolean check(int sum) {
        int s = 0, cnt = 1;
        right[cnt] = n;
        for (int i = n; i >= 1; i--) {
            if (s + w[i] <= sum) {
                s += w[i];
            } else {
                left[cnt] = i + 1;
                cnt++;
                right[cnt] = i;
                s = w[i];
            }
        }
        left[cnt] = 1;
        return cnt <= k;
    }
}
